package com.yanqu.road.dataHelper.action;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.yanqu.road.dataHelper.manager.ServerMgr;
import com.yanqu.road.entity.player.OpenInvitedData;
import com.yanqu.road.entity.player.PlatformUserPotential;
import com.yanqu.road.logic.redis.RedisManger;

import java.util.List;

public class PotentialToRedis extends actionBase{

    public void go(List<Long> serverList){
       /* List<PlatformUserPotential> list = new ServerMgr().selectAllPotential();
        for (PlatformUserPotential potential : list) {
            JSONObject obj = new JSONObject();
            obj.put("platformUserId", potential.getPlatformUserId());
            obj.put("potential", potential.getPotential());
            RedisManger.getRedisUtil().setString("POTENTIAL-" + potential.getPlatformUserId(), JSON.toJSONString(obj));
        }*/
        invitedCodeInto();
    }

    public void invitedCodeInto() {
        List<OpenInvitedData> list = new ServerMgr().selectAllInvitedData();
        for (OpenInvitedData data : list) {
            JSONObject object = new JSONObject();
            object.put("openId",data.getOpenId());
            object.put("invitedCode",data.getInvitedCode());
            object.put("registerTime",data.getRegisterTime());
            RedisManger.getRedisUtil().setString("PLAYER-INVITED-" + data.getOpenId(),JSON.toJSONString(object));
        }
    }
}
